import React from 'react';
import {
  Form,
  Input,
  InputNumber,
  Cascader,
  Select,
  Row,
  Col,
  Radio,
  Checkbox,
  Button,
  AutoComplete,
  Switch,
  Space,
} from 'antd';
import Vip from './component/vip.js'
import Promo from './component/promo.js'
import Minus from './component/minus.js'
import Ladder from './component/ladder.js'

const { TextArea } = Input;
export default  class extends React.Component{
	state={
		selectOption:[
			{content:<Promo/>},
			{content:<Vip/>},
			{content:<Ladder/>},
			{content:<Minus/>},
		],
		
		service:[
					{label:"无忧退货",value:"1"},
					{label:"快速退款",value:"2"},
					{label:"免费包邮",value:"3"}
				]
	}
	promo=(a,b)=>{
		console.log(a,b)
	}
	render(){
		const {handleStep,productData} = this.props;
		
		
		
		const onFinish = (values) => {
			
			values.previewStatus = values.previewStatus?1:0;
			values.publishStatus = values.publishStatus?1:0;
			values.recommandStatus = values.recommandStatus?1:0;
			
			//处理服务  -- 将数组转成字符串
			values.serviceIds = values.serviceIds.join(",");
			
			console.log('第二个页面的数据: ', values);
		    Object.assign(productData,values);
			
			handleStep(1)
		};
		return <Form
		name="proinfo"
		onFinish={onFinish}
		style={{marginTop:'20px'}}
	  >
		<Form.Item
			style={{marginLeft:'10px'}}
			name="giftPoint"
			label="赠送积分"
			initialValue={0}
		>
		  <Input style={{width:'600px'}} />
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-5px'}}
			name="giftGrowth"
			label="赠送成长值"
			initialValue={0}
		>
		  <Input  style={{width:'600px'}}/>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-20px'}}
			name="usePointLimit"
			label="积分购买限制"
			initialValue={0}
		>
		  <Input style={{width:'600px'}}/>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'10px'}}
			name="previewStatus"
			label="预告商品"
		>
		  <Switch />
		</Form.Item>
		<Form.Item
			style={{marginLeft:'10px'}}
			name="publishStatus"
			label="商品上架"
		>
		  <Switch />
		</Form.Item>
		<Form.Item
			style={{marginLeft:'10px'}}
			name="recommandStatus"
			label="商品推荐"
		>
			<p style={{lineHeight:'32px',marginBottom:'0'}}><Space><span>新品</span><Switch /><span>推荐</span><Switch /></Space></p>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'10px'}}
			name="serviceIds"
			label="服务保证"
		>
			 <Checkbox.Group
			      options={this.state.service}
			      defaultValue={["1"]}
			    />
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-5px'}}
			name="detailTitle"
			label="详细页标题"
		>
		  <Input style={{width:'600px'}}/>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-5px'}}
			name="detailDesc"
			label="详细页描述"
		>
		  <Input style={{width:'600px'}}/>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-5px'}}
			name="keywords"
			label="商品关键字"
		>
		  <Input style={{width:'600px'}}/>
		</Form.Item>
		<Form.Item
			style={{marginLeft:'8px',width:'670px'}}
			name="note"
			label="商品备注"
		>
		  <TextArea />
		</Form.Item>
		<Form.Item
			style={{marginLeft:'-20px'}}
			name="sel_discount"
			label="选择优惠方式"
		>
			<Radio.Group defaultValue="0">
			  <Radio.Button value="0">无优惠</Radio.Button>
			  <Radio.Button value="1">特价促销</Radio.Button>
			  <Radio.Button value="2" onClick={this.promo.bind(this,this.current)}>会员价格</Radio.Button>
			  <Radio.Button value="3">阶梯价格</Radio.Button>
			  <Radio.Button value="4">满减价格</Radio.Button>
			</Radio.Group>
			<div style={{width:'360px',textAlign:'center'}}>content</div>
		</Form.Item>
	 
	  <Button type="primary" onClick={handleStep.bind(this,-1)}>上一步,填写商品信息</Button>
	  <Button type="primary" htmlType="submit" >下一步,填写商品属性</Button>
	 </Form>
	}
}